doors batch mode hangs if I call it from web service

Hello,

at the moment I try to call the doors client in batch mode from a Java web service. If the service sends the command, the doors console windows appears and then hangs without any output forever.

The doors installation (client / server) is in version :  9.6.0.0

Here the source code I'm using for this:

String doors = "\"C:\\Program Files\\IBM\\Rational\\DOORS\\9.6\\bin\\doors.exe\"";
String server = "36323@wsvsdoors01";
String user = "myUsername";
String pwd = "myPassword";
String script = "C:\\Daten\\SOA\\Solutions\\DOORS\\DXLScripts\\listAllProjects.dxl";

String[] cmd = new String[9];
cmd[0] = doors;
cmd[1] = "-b";
cmd[2] = script;
cmd[3] = "-d";
cmd[4] = server;
cmd[5] = "-u";
cmd[6] = user;
cmd[7] = "-P";
cmd[8] = pwd;

Process p = null;
try {
 p = Runtime.getRuntime().exec(cmd);

 InputStream stderr = p.getErrorStream();
 InputStreamReader isr = new InputStreamReader(stderr);
 BufferedReader br = new BufferedReader(isr);
 
 String line = null;
 while( (line = br.readLine()) != null) {
  System.out.println("line: " + line);
 }
 
 int exitVal = p.waitFor();
}

 

I also tried to do this with the complete command as a single string and using the ProcessBuilder. The result is always the same.

If I execute this command line from a windows prompt the client starts and executes the script without a problem.

 

Maybe someone has experience with this can give me a good hint.

Thanks in advance.

Regards,

Andre


Azielinski - Tue Aug 22 03:49:13 EDT 2017

Re: doors batch mode hangs if I call it from web service
Mathias Mamsch - Tue Aug 22 04:34:05 EDT 2017

You need to pass the --nowait parameter ("-w") to avoid the DOORS process pausing after outputting in stdout. See also similar posts on the forum. Regards, Mathias

Re: doors batch mode hangs if I call it from web service
Azielinski - Tue Aug 22 04:58:08 EDT 2017

Mathias Mamsch - Tue Aug 22 04:34:05 EDT 2017

You need to pass the --nowait parameter ("-w") to avoid the DOORS process pausing after outputting in stdout. See also similar posts on the forum. Regards, Mathias

Thanks for the quick answer.

Now the client window shortly appears and then close, but I would expect to get some output from this process. At least the stuff which I print in the DXL script, or an error message if the execution failed.

 

Regards,

Andre

Re: doors batch mode hangs if I call it from web service
Mathias Mamsch - Tue Aug 22 05:10:33 EDT 2017

Azielinski - Tue Aug 22 04:58:08 EDT 2017

Thanks for the quick answer.

Now the client window shortly appears and then close, but I would expect to get some output from this process. At least the stuff which I print in the DXL script, or an error message if the execution failed.

 

Regards,

Andre

Read the other posts about output redirection with DOORS. The "print" perm does not output to stdout. Instead you would need to use cout. 

See here: 

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014817346&ps=25

or here: 

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014528886&ps=25

or other posts. Search for "cout batch".

Regards, Mathias

Re: doors batch mode hangs if I call it from web service
Mathias Mamsch - Tue Aug 22 05:12:19 EDT 2017

Mathias Mamsch - Tue Aug 22 05:10:33 EDT 2017

Read the other posts about output redirection with DOORS. The "print" perm does not output to stdout. Instead you would need to use cout. 

See here: 

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014817346&ps=25

or here: 

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014528886&ps=25

or other posts. Search for "cout batch".

Regards, Mathias

I would not use stdout. Instead I would pass in a filename to the DXL process to write the results to and read that file after the process ends. This makes sure you only get what you write. Output inside a batch script should be considered an error. Imagine someone puts a print statement inside a library or some dxl attribute prints stuff, which will completely mess up your output. 

Regards, Mathias

Re: doors batch mode hangs if I call it from web service
Azielinski - Tue Aug 22 05:49:53 EDT 2017

Thanks Mathias for your help.

I could manage to get the output via cout. I will continue with this way. Maybe I will come back to your suggestion with the file handling.

 

Regards,

Andre